/**
 * 
 */
package com.apchernykh.rozhlasapp.podcast;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class PodcastShowItem {
	private String mTitle;
	private String mDescription;
	private Date mTimeTermin;
	private String mUrl;
	final private static SimpleDateFormat mCzechDateFormat = new SimpleDateFormat(
			"d MMM HH:mm", Locale.getDefault());

	public PodcastShowItem(String iName, String iDescription, Date iTimeTermin,
			String iUrl) {
		mTitle = iName;
		mDescription = iDescription;
		mTimeTermin = iTimeTermin;
		mUrl = iUrl;
		// Now cut out the date from the name - it will be bold
		final int aFoundBrace = mTitle.indexOf('(');
		if (aFoundBrace != -1)
			mTitle = mTitle.substring(0, aFoundBrace);
	}

	public String getTitle() {
		return mTitle;
	}

	public String getDescription() {
		return mDescription;
	}

	public Date getTime() {
		return mTimeTermin;
	}

	public String getTimeString() {
		if (mTimeTermin != null)
			return mCzechDateFormat.format(mTimeTermin);
		return "Neznamy datum"; // ???
	}

	private String getString() {
		return getTimeString() + getDescription() + getTitle() + getClass();
	}

	public boolean literallyEquals(PodcastShowItem iPodcastShowItem) {
		return this.getString().equals(iPodcastShowItem.getString());
	}

	public String getUrl() {
		return mUrl;
	}

}